Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 2 - Geometric Shapes / Geometric Shapes Reference
Functions / Creating Geometric Shapes


GXNewRectangle

You can use the GXNewRectangle function to create a new rectangle shape and initialize its geometry.

gxShape GXNewRectangle(const gxRectangle *data);
data
A pointer to the initial rectangle geometry.
function result
A reference to the new rectangle shape.
DESCRIPTION
The GXNewRectangle function creates a copy of the default rectangle shape, sets the owner count of the copy to 1, initializes its geometry with the values in the data parameter, and returns a reference to it as the function result.

Although this function creates a copy of the default rectangle shape, it does not create a copy of the default rectangle's style, ink, or transform objects. The new rectangle shape returned by this function contains references to same style, ink, and transform as the default rectangle shape.

SPECIAL CONSIDERATIONS
If no error occurs, the GXNewRectangle function creates a shape; you are responsible for disposing of this shape when you no longer need it. See Inside Macintosh: QuickDraw GX Objects for information about creating and disposing of shapes.

If an error occurs, this function returns nil as the function result.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
parameter_is_nil(debugging version)
SEE ALSO
For an example that uses this function, see "Creating and Drawing Rectangles" beginning on page 2-43.

For a discussion of rectangles and the default rectangle shape, see "Rectangle Shapes" beginning on page 2-20.

For a description of the gxRectangle structure, see page 2-106.

To create a new rectangle shape without specifying an initial geometry, see the description of the GXNewShape function in the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.

To set the geometry of an existing rectangle shape, see the description of the GXSetRectangle function on page 2-129.

To draw a rectangle geometry without creating a rectangle shape, see the description of GXDrawRectangle on page 2-160. To draw a rectangle shape, see the description of GXDrawShape in the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help